package com.yonghui.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.yonghui.dto.UserDTO;
import com.yonghui.service.UserInfoService;
import com.yonghui.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;

/**
 * @description: TODO
 * @author: zhangtong
 * @create: 2021-03-19 19:45
 **/
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserInfoService userInfoService;

    @Reference(timeout = 300)
    private UserService userService;

    @RequestMapping("/getUserList")
    public Object getUserList(@RequestParam String name) {
        System.out.println("name=="+name);
        List<UserDTO> userList = userService.getUserList(name);
        return userList;
    }

    @RequestMapping("/getUser")
    public Object getUserInfo(String name){
        System.out.println("name=="+name);
        UserDTO userInfo = userInfoService.getUserInfo();
        return userInfo;
    }

}
